package com.pro.mybatis;

import java.util.Date;

public class MyBatisExpression{
	
	//小于
	public static String lt(String colume,String value,boolean flag){
		return colume + "<" + (flag?"=":"")+"'" +value+"'";
	}
	//大于
	public static String bt(String colume,String value,boolean flag){
		return colume + ">"  +(flag?"=":"") +"'" +value+"'";
	}
	public static String bt(String colume,Date value,boolean flag){
		if(value==null){
			return "";
		}
		return colume + ">"  +(flag?"=":"") +"'" +value+"'";
	}
	public static String lt(String colume,Date value,boolean flag){
		if(value==null){
			return "";
		}
		return colume + "<"  +(flag?"=":"")  +"'" +value+"'";
	}
	public static String like(String colume,String value){
		if(value==null || value.equals("")){
			return "";
		}
		return colume + " like "  + "'%" + value+"%'";
	}
	//等于
	public static String eq(String colume,String value){
		if(value==null  || value.equals("")){
			return "";
		}
		return colume + "=" + value;
	}
	public static String between(String colume,String minValue,String maxValue){
		return colume + " between " +minValue + " and " + maxValue;
	}
	public static String between(String colume,Date minValue,Date maxValue){
		return colume + " between " +minValue + " and " + maxValue;
	}
}